import { types } from "./types";

// 用户信息 reducer
const initUserInfo = null;
const userInfo = (state = initUserInfo, action: IAction) => {
  const { type, payload } = action;
  switch (type) {
    case types.RECEIVE_USER_INFO:
      return { ...payload };
    case types.INITIAL_USER_INFO:
      return null;
    default:
      return state;
  }
};

export default {
  userInfo,
};
